﻿@page "/Scheduler/Templates/TimeCellTemplate"

<DemoPageSectionComponent Id="Scheduler-Templates-TimeCellTemplate">
    <DemoChildContent>
        <style>
            .customScheduler .dxbl-sc-time-cell {
                height: 250px !important;
            }
        </style>
        <DxScheduler @bind-StartDate="@StartDate"
                     DataStorage="@DataStorage"
                     ActiveViewType="@ActiveViewType"
                     CssClass="demo-sc-size customScheduler">
            <Views>
                <DxSchedulerTimelineView Duration="TimeSpan.FromDays(7)" CellMinWidth="115">
                    <Scales>
                        <DxSchedulerTimeScale Unit="SchedulerTimeScaleUnit.Day"></DxSchedulerTimeScale>
                    </Scales>
                    <TimeCellTemplate>
                        <div style="height: 100%; display: flex; align-items: flex-end;">
                            Count: @DataStorage.GetAppointments(context.Interval).ToList().Count
                        </div>
                    </TimeCellTemplate>
                </DxSchedulerTimelineView>
            </Views>
        </DxScheduler>
    </DemoChildContent>

    @code {
        DateTime StartDate { get; set; } = DateTime.Today;
        SchedulerViewType ActiveViewType { get; set; } = SchedulerViewType.Timeline;

        DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
            AppointmentsSource = RecurringAppointmentCollection.GetAppointments(),
            AppointmentMappings = new DxSchedulerAppointmentMappings() {
                Type = "AppointmentType",
                Start = "StartDate",
                End = "EndDate",
                Subject = "Caption",
                AllDay = "AllDay",
                Location = "Location",
                Description = "Description",
                LabelId = "Label",
                StatusId = "Status",
                RecurrenceInfo = "Recurrence"
            }
        };
    }
</DemoPageSectionComponent>
